import {
  basicRole,
  RoleData,
  SearchRole,
  UserData,
  UserSearch,
} from '@/types/sys';
import request from '@/utils/request';

export const getRoleList = (data: SearchRole) => {
  return request.get('/api/role/page', data);
};

export const addRole = (data: basicRole) => {
  return request.post('/api/role', data);
};

export const removeRole = (id: string) => {
  return request.delete(`/api/role/${id}`);
};
export const updateRole = (data: RoleData) => {
  return request.put('/api/role', data);
};

export const addUser = (data: UserData) => {
  return request.post('/api/user', data);
};
export const getUserList = (data: UserSearch) => {
  return request.get('/api/user', data);
};
export const updateUser = (data: UserData) => {
  return request.put('/api/user', data);
};
export const deleteUser = (id: string) => {
  return request.delete(`/api/user/${id}`);
};

// 菜单

export const getMenuList = () => {
  return request.get('/api/menu');
};
